package com.yhq.spring.spring.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;

/**
 * @author hqyin
 * @date 2023/1/30 11:26 上午
 */
//@Aspect
//@Component
public class LogAspect {
    @Pointcut("execution(* com.yhq.spring.spring.service.UserService.test())")
    private void logAdvicePointcut() {

    }

    @Before("logAdvicePointcut()")
    public void before(JoinPoint point) {
        System.out.println("before execute UserService.test()");
        ;
    }

//    @After("logAdvicePointcut()")
//    public void after() {
//        System.out.println("after execute UserService.test()");
//    }

    @AfterReturning("logAdvicePointcut()")
    public void afterReturning() {
        System.out.println("afterReturning execute UserService.test()");
    }

    @AfterThrowing("logAdvicePointcut()")
    public void afterThrowing() {
        System.out.println("afterThrowing execute UserService.test()");
    }

//    @Around("logAdvicePointcut()")
//    public void around() {
//        System.out.println("around execute UserService.test()");
//    }




}
